<?php
use yii\helpers\Url;
?>
<?php $this->beginBlock('content') ?>
<div class="row">
   <div class="col-sm-12">
        <div class="white-box">
            <h3 class="box-title"></h3>
            <div class="row m-b-15">
                <div class="col-sm-10">
                    <form action="">
                        <div class="row">
                            <div class="col-sm-2">
                                <select class="selectpicker m-b-20 m-r-10" id="status" name="status" data-style="form-control">
                                    <option value="">全部</option>
                                    <?php foreach (\common\models\Admin\Admin::getStatusMap() as $key => $item): ?>
                                        <option value="<?=$key?>"><?=$item?></option>
                                    <?php endforeach ?>
                                </select>
                            </div>
                            <div class="col-sm-4">
                                <div class="input-group">
                                    <input type="text" class="form-control m-r-5" name="username" value="<?=Yii::$app->request->get('username')?>" placeholder="账号名称">
                                    <span class="input-group-btn">
                                        <button class="btn btn-info" type="submit">
                                            搜索
                                        </button>
                                    </span>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>

                <div class="col-sm-2">
                    <button class="fcbtn btn btn-danger btn-outline btn-1e" onclick="window.location.href='<?=Url::to(['item'])?>'">
                        添加数据
                    </button>
                </div>
            </div>
            <div class="table-responsive">
                <table class="table table-hover">
                    <thead>
                    <tr>
                        <th>ID</th>
                        <th>区域经理账号</th>
                        <th>区域经理名称</th>
                        <th>支付宝账号</th>
                        <th>收钱码</th>
                        <th>状态</th>
                        <th>创建时间</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php foreach ($ret as $item): ?>
                    <tr>
                        <td><?=$item["id"]?></td>
                        <td>
                            <?=$item["username"]?>
                        </td>
                        <td><?=$item["regionManagerInfo"]["name"]?></td>
                        <td><?=$item["regionManagerInfo"]["ali_account"]?></td>
                        <td>
                            <?php if ($item["regionManagerInfo"]["rev_price_image"]) : ?>
                                <a href="<?=Url::to(["/attachment/show-img", "url" => $item["regionManagerInfo"]["rev_price_image"], "w" => "400", "h" => "500"])?>" rel-action="open" rel-title="收钱码">点击查看</a>
                            <?php else :?>
                                无
                            <?php endif ?>
                        </td>
                        <td><?=$item["created_time"]?></td>
                        <td>
                            <?php if ( $item["status"] == \common\models\Admin\Admin::STATUS_YES ) : ?>
                                <span class="label label-rouded label-success"><?=\common\models\Admin\Admin::getStatusMap($item["status"])?></span>
                            <?php elseif( $item["status"] == \common\models\Admin\Admin::STATUS_NO ) :?>
                                <span class="label label-rouded label-danger"><?=\common\models\Admin\Admin::getStatusMap($item["status"])?></span>
                            <?php else :?>
                                <span class="label label-rouded label-warning"><?=\common\models\Admin\Admin::getStatusMap($item["status"])?></span>
                            <?php endif ?>
                        </td>

                        <td>
                            <?php if ($item["status"] == \common\models\Admin\Admin::STATUS_YES) : ?>
                                <a href="<?=Url::to(["update-status", "status" => \common\models\Admin\Admin::STATUS_NO])?>" rel-id="<?=$item["id"]?>"  data-toggle="tooltip" data-original-title="锁定" rel-action="prompt" rel-title="您确定要锁定该用户吗？"> 锁定 </a>
                            <?php else :?>
                                <a href="<?=Url::to(["update-status", "status" => \common\models\Admin\Admin::STATUS_YES])?>" rel-id="<?=$item["id"]?>"  data-toggle="tooltip" data-original-title="解锁" rel-action="prompt" rel-title="您确定要解锁该用户吗？"> 解锁 </a>
                            <?php endif ?>
                            <a href="<?=Url::to(["item", "id" => $item["id"]])?>" data-toggle="tooltip" data-original-title="编辑"> 编辑 </a>
                        </td>
                    </tr>
                    <?php endforeach ?>
                    </tbody>
                    <tfoot>
                    <tr>
                        <td colspan="14" class="footable-visible">
                            <div class="text-right">
                                <?=\common\components\DataHelper::getLinkPager($page)?>
                            </div>
                        </td>
                    </tr>
                    </tfoot>
                </table>
            </div>
        </div>
    </div>
</div>
<?php $this->endBlock()?>
<?php $this->beginBlock("script")?>
<script>
    autoSelect('status','<?=Yii::$app->request->get('status')?>');
</script>
<?php $this->endBlock(); ?>
